#include"processbar.h"

const char Wheel[] = "\\|/-";
int Wheelcnt = 0;
int percent = 0;
char BarArr[NUM];

void processbar(double rate)
{
  if(0 == percent)
    memset(BarArr, '\0', sizeof(BarArr));
  Wheelcnt = ++Wheelcnt % strlen(Wheel);
  int Rate = (int)rate;
  while(percent <= Rate)
  {
    BarArr[percent++] = body;
    if(percent < 100)
      BarArr[percent] = head;
  }
    printf("[%-101s][%.1f%%](%c)\r", BarArr, rate, Wheel[Wheelcnt]);
    fflush(stdout);
}
